package fw;

import projects.telerik.helpers.NavigationTelerikHelper;
import projects.telerik.pageObjects.IndexPage;

public class Telerik
{
	private final ApplicationManager app;
	private NavigationTelerikHelper navigate;

	/* Pages */
	private IndexPage indexPage = null;

	/* Page constants */
	public final static String INDEX_PAGE = "IndexPage";

	public Telerik(ApplicationManager p_app) {
		app = p_app;
	}

	/**
	 * resets Pages Cache Do not forget add new pages
	 */
	public void resetPagesCashe() {
		indexPage = null;
	}

	public NavigationTelerikHelper navigate() {
		resetPagesCashe();
		return is();
	}

	public NavigationTelerikHelper is() {
		if (navigate == null) {
			navigate = new NavigationTelerikHelper(app);
		}
		return navigate;
	}

	/**
	 * Index page
	 * 
	 * @return
	 */
	public IndexPage indexPage() {
		app.setTestPage(INDEX_PAGE);

		if (indexPage == null) {
			indexPage = new IndexPage(app);
		}
		return indexPage;
	}

}
